home *** CD-ROM | disk | FTP | other *** search
/ ADA Programming Guide / ADA Programming Guide.iso / ada_gnu / adainc / s-os2lib.ads < prev    next >
Text File  |  1996-01-30  |  5KB  |  110 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                 GNU ADA RUNTIME LIBRARY (GNARL) COMPONENTS               --
  4. --                                                                          --
  5. --                         S Y S T E M . O S 2 L I B                        --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.4 $                             --
  10. --                                                                          --
  11. --             Copyright (c) 1993,1994 NYU, All Rights Reserved             --
  12. --                                                                          --
  13. --  GNARL is free software; you can redistribute it and/or modify it  under --
  14. --  terms  of  the  GNU  Library General Public License as published by the --
  15. --  Free Software Foundation; either version 2,  or (at  your  option)  any --
  16. --  later  version.   GNARL is distributed in the hope that it will be use- --
  17. --  ful, but but WITHOUT ANY WARRANTY; without even the implied warranty of --
  18. --  MERCHANTABILITY  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Gen- --
  19. --  eral Library Public License for more details.  You should have received --
  20. --  a  copy of the GNU Library General Public License along with GNARL; see --
  21. --  file COPYING. If not, write to the Free Software Foundation,  675  Mass --
  22. --  Ave, Cambridge, MA 02139, USA.                                          --
  23. --                                                                          --
  24. ------------------------------------------------------------------------------
  25.  
  26. --  This package (and children) provide interface definitions to the standard
  27. --  OS/2 Library. They are merely a translation of the various <bse*.h> files.
  28.  
  29. --  It is intended that higher level interfaces (with better names, and
  30. --  stronger typing!) be built on top of this one for Ada (i.e. clean)
  31. --  programming.
  32.  
  33. --  We have chosen to keep names, types, etc.  as close as possible to the
  34. --  C definition to provide easier reference to the documentation. The main
  35. --  exception is when a formal and its type (in C) differed only by the case
  36. --  of letters (like in HMUX hmux). In this case, we have prepended "F_" to
  37. --  the formal (i.e. F_hmux : HMUX).
  38.  
  39. with Interfaces.C;         use Interfaces.C;
  40. with Interfaces.C.Strings; use Interfaces.C.Strings;
  41.  
  42. package System.OS2Lib is
  43. pragma Preelaborate (OS2Lib);
  44.  
  45.    -------------------
  46.    -- General Types --
  47.    -------------------
  48.  
  49.    type    APIRET   is new unsigned_long;
  50.    type    APIRET16 is new unsigned_short;
  51.    subtype APIRET32 is     APIRET;
  52.  
  53.    subtype PSZ   is chars_ptr;
  54.    subtype PCHAR is chars_ptr;
  55.    subtype PVOID is System.Address;
  56.  
  57.    type BOOL32 is new unsigned_long;
  58.    False32 : constant BOOL32 := 0;
  59.    True32  : constant BOOL32 := 1;
  60.  
  61.    type UCHAR  is new unsigned_char;
  62.    type USHORT is new unsigned_short;
  63.    type ULONG  is new unsigned_long;
  64.    type PULONG is access all ULONG;
  65.  
  66.    ---------------------
  67.    -- Time Manegement --
  68.    ---------------------
  69.  
  70.    procedure DosSleep (How_long : int);
  71.    pragma Import (C, DosSleep, Link_name => "DosSleep");
  72.  
  73.    type DATETIME is
  74.       record
  75.            hours      : UCHAR;
  76.            minutes    : UCHAR;
  77.            seconds    : UCHAR;
  78.            hundredths : UCHAR;
  79.            day        : UCHAR;
  80.            month      : UCHAR;
  81.            year       : USHORT;
  82.            timezone   : short;
  83.            weekday    : UCHAR;
  84.       end record;
  85.  
  86.    type PDATETIME is access all DATETIME;
  87.  
  88.    function DosGetDateTime (pdt : PDATETIME) return APIRET;
  89.    pragma Import (C, DosGetDateTime, Link_Name => "DosGetDateTime");
  90.  
  91.    function DosSetDateTime (pdt : PDATETIME) return APIRET;
  92.    pragma Import (C, DosSetDateTime, Link_Name => "DosSetDateTime");
  93.  
  94.    ----------------------------
  95.    -- Miscelleneous Features --
  96.    ----------------------------
  97.  
  98.    --  Features which do not fit any child
  99.  
  100.    function DosBeep (Freq : ULONG; Dur : ULONG) return APIRET;
  101.    pragma Import (C, DosBeep, Link_Name => "DosBeep");
  102.  
  103.    procedure Must_Not_Fail (Return_Code : OS2Lib.APIRET);
  104.    --  Many OS/2 functions return APIRET and are not supposed to fail. In C
  105.    --  style, these would be called as procedures, disregarding the returned
  106.    --  value. This procedure can be used to achieve the same effect with a
  107.    --  call of the form: Must_Not_Fail (Some_OS2_Function (...));
  108.  
  109. end System.OS2Lib;
  110.